<template>
  <div class="pb-12 min-h-screen" style="min-width: 1200px;width: 1200px;margin:auto">
    <div class="py-4 bg-white">
      <h2 class="text-xl pt-2 font-bold">江西省独角兽 | 瞪羚</h2>
      <h2 class="text-xl pt-2 font-bold">企业服务平台</h2>
    </div>
    <div class="flex justify-between py-2 mb-4 align-middle border-b">
      <span class="text-xl font-bold">公告列表</span>
      <div class="text-sm">
        当前位置:
        <router-link :to="{ path: '/' }">首页</router-link>/
        <span>通知公告</span>
      </div>
    </div>
    <div>
      <div
        v-for="item in noticeList"
        :key="item.annunciatePolicyId"
        class="flex justify-between py-3 border-b border-dashed cursor-pointer hover:bg-gray-100 alink"
        @click="toNoticeDetail(item.annunciatePolicyId)"
      >
        <p class="flex-grow-2 max-w-3xl h-4 truncate">{{ item.title }}</p>
        <span
          class="not-italic text-gray-400 flex-grow-1 min-w-8rem text-right"
        >{{ item.publishTime }}</span>
      </div>
    </div>

    <pagination
      v-show="tableTotal > 0"
      :total="tableTotal"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />
  </div>
</template>

<script>
import { getNoticeList } from "@/api/notice";
export default {
  name: "notice",
  data() {
    return {
      tableTotal: 1,

      queryParams: {
        pageSize: 10,
        pageNum: 1,
      },
      noticeList: [
        {
          annunciatePolicyId: "",
          title: "",
          publishTime: "",
          content: "",
        },
      ],
    };
  },
  created() {
    // this.initId();
    // this.getList()
    this.getList();
  },
  methods: {
    getList() {
      let query = this.queryParams;
      getNoticeList(query).then((res) => {
        this.tableTotal = res.total;
        this.noticeList = res.rows;
      });
    },
    toNoticeDetail(id) {
      this.$router.push({ name: "noticeDetail", params: { id } });
    },
  },
};
</script>

<style></style>
